$(function(){
	targetDetails();
	mbxqQd();
	joinNewTarget();
});
//��ת��Ŀ������ҳ��
function targetDetails(){
//	$('.standard tbody tr td a').click(function(e){
//		e.stopPropagation();
//		var job_id=$(this).attr("class");
//		alert(job_id);
		var html='<button class="my_join">加入</button>';
		var html1='';
		var html2='';
		$.ajax({
			url:'/WDDXSERVER/professionalAssessment/getTargetDetailsFromEvaluatingWithApp.action?userid='+user_id+'&ticket='+ticket,
			data:{
				targetID:targetId
			},
			async:false,
			success:function(data){
				 console.log(data["content"].message.sign_img.length);
				 html+='<div class="my_describe">'
					 	+'<label>描述：</label><span>'+data["content"].message.t_describe+'</span>'
				  +'</div>';
				  html1=' <div class="my_card">'
				 	+'<label>今日打卡</label>'
				 	+'<div class="qd_img">';
				  if(!(data["content"].message.sign_img.length==0||data["content"].message.sign_img.length==null)){
					  $.each(data["content"].message.sign_img,function(i,r){
							html1+='<img src="'+r[i]+'">';
						});
				  }
				 html1+='</div><span>共20人</span></div>';
				 html2+='<div class="my_sign_list" ><ul>';
				 if(!(data["content"].message.details.length==0||data["content"].message.details.length==null)){
					 $.each(data["content"].message.details,function(i,r){
						 html2+='<li><span class="my_px">'+(i+1)+'</span><a href="Javascript:;">'+r["c_name"]+'</a><span><div class="my_qd" id="'+r["c_id"]+'"></div><span>签到'+r["total"]+'次</span></span><p><label>参考资料</label><span><a href="#">'+r["c_resource"]+'</a></span></p></li>';
					 });
				  }
				 html2+='</ul></div>';
					
			}
		});
		html+=html1+html2;
		$('div.my_goal').empty().append(html);
//	});
}
//签到
function mbxqQd(){
	$('.my_sign_list ul li span div.my_qd').click(function(){
		if($(this).hasClass('qd_active')){
			$(this).removeClass('qd_active');
		}else{
			$(this).addClass('qd_active');
		}
	});
}
//添加目标
function joinNewTarget(){
	$('div.my_goal>button.my_join').click(function(){
		$.ajax({
			url:'/WDDXSERVER/target/addTargetApp.action?userid='+user_id+'&ticket='+ticket,
			data:{
				targetID:targetId
			},
			success:function(data){
			}
		});
	
	});
}

